import { Injectable } from '@angular/core';
import {ReplaySubject} from "rxjs";
import { Observable } from 'rxjs';
@Injectable({
  providedIn: 'root'
})
export class SubscribeService {
  private subject :ReplaySubject<any>=new ReplaySubject<any>();
  constructor() { }
    // 发送的消息
    public sendLevel(message:any):void{
     this.subject.next(message)
    }
    //需要接收的信息
    public getLevel():Observable<any>{
        return this.subject.asObservable();
    }

}
